<template>
  <div class="page-table">
    <ad-table ref="order" :show-summary="orderSummary"
              :data="orderList" v-loading="orderInitLoading" border u-table
              :data-changes-scroll-top="orderIsScrollTop" @table-body-scroll="orderGetMoreList"
              @row-click="orderSelectRow" @selection-change="orderSelectRows"
              :searchQuery="orderSearchQuery" @search="orderGetInitList"
              @sort-change="orderSortInitList" @filter-change="orderFilterInitList" :height="tableHeight">
      <ad-table-column label="序号" type="index" ctype="index" fixed/>
      <u-table-column label="中转次数" prop="settlementTime" width="80">
        <template v-slot="{row}">
          <span>直达</span>
        </template>
      </u-table-column>
      <ad-table-column label="出发地" prop="startCode" queryPro="startName" ctype="city" searchable/>
      <ad-table-column label="目的地" prop="destinationCode" queryPro="destinationName" ctype="city" searchable/>
      <ad-table-column label="参考报价" prop="totalFee" width="100" sortable/>
      <ad-table-column label="利润" prop="profit" width="100" sortable/>
      <ad-table-column label="运输时效" prop="days" width="100" sortable/>
      <ad-table-column label="承运成本" prop="cost" width="100" sortable/>
      <ad-table-column label="供应商" prop="companyName" w="3c2f" searchable/>
      <ad-table-column label="网点城市" prop="siteName" w="3c2f" searchable/>
      <ad-table-column label="联系人" prop="linkman" w="3c2f" searchable/>
      <ad-table-column label="联系电话" prop="linkPhone" ctype="phone-2f" searchable/>
      <ad-table-column label="添加人" prop="createUserName" w="3c2f" searchable/>
      <ad-table-column label="更新时间" prop="updateTime" ctype="datetime" sortable/>
      <ad-table-column label="备注" prop="remark" width="200"/>
      <ad-table-column label="操作" fixed="right" width="50">
        <template v-slot="{row}">
          <div class="op">
<!--            <el-button type="text" class="op-btn" @click="openOrderAdder(row)">修改</el-button>-->
            <el-button type="text" class="op-btn" @click="openOrderAdder(row)">审核</el-button>
          </div>
        </template>
      </ad-table-column>
    </ad-table>

    <el-dialog :title="titleName" :visible.sync="orderAdder.visible" custom-class="ad-dialog" width="600px">
      <adder :mode="orderAdder.mode" :id="orderSelectedRowId" :visible.sync="orderAdder.visible" @saved="orderSaved"/>
    </el-dialog>
  </div>
</template>

<script>
  import AdTable from '@/components/AdTable'
  import AdTableColumn from '@/components/AdTable/AdTableColumn'
  import AdCitySelect from '@/components/AdCitySelect'
  import adder from './add'
  import adTable from '@/mixins/adTable/index'
  import AdSelect from '@/components/AdSelect'
  import api, {getList as orderApiGetList} from '@/api/reviewPrice'

  export default {
    name: 'price-reviewPrice',
    components: {AdSelect, AdTable, AdTableColumn, AdCitySelect, adder},
    mixins: [adTable('order')],
    data() {
      return {
        startCode: null,
        destinationCode: null,
        tableHeight: document.documentElement.clientHeight - 102,
        dialogVisible: false,
        infoForm: {
          type: null,
          customerSubject: null,
          settlementUser: null,
          settlementTime: null,
          createUser: null,
          createTime: null,
          collectionFee: null,
          paymentFee: null,
          balanceFee: null,
          channel: null,
          imgList: [],
          remark: null,
        },
        titleName: '',
      }
    },
    created() {
      this.orderGetInitList()
    },
    methods: {
      orderApiGetList,
      queryList: function () {
        let self = this;
        if (!self.startCode || !self.destinationCode) {
          self.$notify({
            title: '价格查询',
            message: '请选择出发地和目的地',
            position: 'bottom-right',
            type: 'warning'
          });
          return
        }
        self.$nextTick(() => {
          self.$refs['detailed'].searchTable();
        });
        // self.orderGetInitList()
      },
      //修改
      openOrderAdder() {
        let self = this;
        self.titleName = '修改价格';
        setTimeout(() => self.orderEdit())
      }
    }
  }
</script>

<style lang="scss" scoped>
</style>